﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Entity.Model;
using SystemFrameWork.Enums;

namespace BLL
{
    public class Sys_RoleManagement : EntityManagement
    {
        private Sys_RoleDAO sys_RoleDAO = new Sys_RoleDAO();

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<Sys_Role> LoadUserGroupByUser(Sys_User sys_User)
        {
            return this.sys_RoleDAO.LoadRoleByUser(sys_User);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="userGroupID"></param>
        /// <returns></returns>
        public List<Guid?> LoadFunctionModuelID(Guid userGroupID)
        {
            return this.sys_RoleDAO.LoadFunctionModuelID(userGroupID);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="Role"></param>
        public void Insert(Sys_Role Role)
        {
            this.sys_RoleDAO.Insert(Role);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="functionModule_Group"></param>
        public void Insert(Sys_FunctionModuleSys_Role functionModule_Group)
        {
            this.sys_RoleDAO.Insert(functionModule_Group);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="functionModule_Group"></param>
        public void Insert(Sys_DepartmentRole departmentGroup)
        {
            this.sys_RoleDAO.Insert(departmentGroup);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="userGroupName"></param>
        /// <returns></returns>
        public Sys_Role LoadUserGroupByName(string roleName)
        {
            return this.sys_RoleDAO.LoadRoleByName(roleName);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Sys_Role LoadUserGroupByID(Guid id)
        {
            return this.sys_RoleDAO.LoadRoleByID(id);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="Role"></param>
        /// <param name="departmentId"></param>
        /// <param name="functionModuleList"></param>
        /// <returns></returns>
        public List<RoleView> LoadUserGroupByCondition(RoleView Role)
        {
            return this.sys_RoleDAO.LoadRoleByCondition(Role);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        public void BulkRemoveTheSys_Role(List<Sys_Role> list)
        {
            foreach (Sys_Role ug in list)
            {
                this.sys_RoleDAO.RemoveEntity(ug.ID, ug.CurrentUserID);
            }
            base.UpdateChanges();
        }

        public List<Sys_DepartmentRole> LoadSys_DepartmentSys_Role(Guid roleId)
        {
            return this.sys_RoleDAO.LoadSys_DepartmentRole(roleId);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        public void DeleteSys_DepartmentRole(List<Sys_DepartmentRole> list)
        {
            this.sys_RoleDAO.DeleteSys_DepartmentRole(list);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        public void DeleteSys_FunctionModuleSys_UserGroup(List<Sys_FunctionModuleSys_Role> list)
        {
            this.sys_RoleDAO.DeleteSys_FunctionModuleSys_Role(list);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="userGroupId"></param>
        /// <returns></returns>
        public List<Sys_FunctionModuleSys_Role> Load_SysFunctionModuleSys_Role(Guid userGroupId)
        {
            return this.sys_RoleDAO.Load_SysFunctionModuleSys_Role(userGroupId);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<Sys_Role> LoadAllSys_Role()
        {
            return this.sys_RoleDAO.LoadAllSys_Role();
        }
    }
}
